<LayoutEditFormBox :loading="false">

    <template slot="main">
        <el-form ref="editForm" :model="form" label-width="170px" label-position="left">
            <LayoutCell>
                <LayoutCellItem title="基本设置">
                    <el-form-item label="队长分红" prop="basic.agent_bonus" :rules="{ required: true, message: '请选择队长分红'}">
                        <el-radio-group v-model="form.basic.agent_bonus">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    
                    <el-form-item label="分红比例模式" prop="basic.bonus_module" :rules="{ required: true, message: '请选择分红比例模式'}">
                        <el-radio-group v-model="form.basic.bonus_module">
                            <el-radio :label="1">走队长等级</el-radio>
                            <el-radio :label="0">统一比例</el-radio>
                        </el-radio-group>
                    </el-form-item>

                    <el-form-item label="分红比例" prop="basic.bonus_ratio" :rules="{ required: true, message: '分红比例 不能为空'}" v-if="form.basic.bonus_module ==  0">
                        <el-input style="width: 200px;" v-model.number="form.basic.bonus_ratio" type="number"><template slot="append">%</template> </el-input>
                        <div class="text">所有队长统一按照此比例进行分红，最多支持2位小数点，即百万分之一</div> 
                    </el-form-item>

                    <el-form-item label="队长内购" prop="basic.agent_self_bonus" :rules="{ required: true, message: '请选择队长内购'}">
                        <el-radio-group v-model="form.basic.agent_self_bonus">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>
                    </el-form-item>

                    <el-form-item label="商品默认" prop="basic.product_module" :rules="{ required: true, message: '请选择商品模式'}">
                        <el-radio-group v-model="form.basic.product_module">
                            <el-radio :label="0">参与</el-radio>
                            <el-radio :label="1">不参与</el-radio>
                        </el-radio-group>
                        <span class="text">（商品默认是否参与分红）</span>
                    </el-form-item>
                </LayoutCellItem>

                <LayoutCellItem title="队长设置">
                    <el-form-item label="队长自主申请" prop="leader.accord_apply" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.leader.accord_apply">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>
                        <div class="text">关闭此功能，非队长的用户将无法进入团队分红页面，队长资格仅通过后台手动配置</div>
                    </el-form-item>





                    <el-form-item label="申请门槛" prop="leader.accord_condition" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.leader.accord_condition" @change="change()">
                            <!-- <el-radio :label="item.id" v-for="item in captain">{{ item.value }}</el-radio> -->
                            <el-radio :label="0">无(不推荐)</el-radio>
                            <el-radio :label="1">下线总人数</el-radio>
                            <el-radio :label="2">下线队长人数</el-radio>
                            <el-radio :label="3">累计佣金</el-radio>
                            <el-radio :label="4">提现佣金总额</el-radio>
                            <el-radio :label="5">购买指定商品</el-radio>
                        </el-radio-group>
                        <div class="text">设置申请门槛后，达到门槛的用户可以自动或申请成为队长；
                            不设置门槛，则所有用户都可以申请成为队长。</div>
                    </el-form-item>

                    <el-form-item :label="text" prop="leader.condition_content" :rules="{ required: true, message: '不能为空'}" v-if="form.leader.accord_condition == 1 || form.leader.accord_condition == 2 || form.leader.accord_condition == 3 || form.leader.accord_condition == 4">
                        <el-input v-model="form.leader.condition_content" style="width: 200px;">
                            <template slot="append">
                                <span v-if="form.leader.accord_condition == 1 || form.leader.accord_condition == 2">人</span>
                                <span v-if="form.leader.accord_condition == 3 || form.leader.accord_condition == 4">元</span>
                            </template>
                        </el-input>
                    </el-form-item>

                    <el-form-item label="指定商品" v-if="form.leader.accord_condition == 5">
                        <!-- {{form.leader.condition_content}} -->
                        <el-table :data="form.leader.condition_content" v-loading="mixinTable_loading" border style="width: 100%;height: 100%;" :ref="mixinPage_vueName+'TableSmall'"
                                @selection-change="mixinTable_handleSelectionChangeTableSmall">
                            <el-table-column prop="name" label="等级名称" width="100"></el-table-column>
                            <el-table-column prop="name" label="商品">
                                <template slot-scope="scope">
                                    <SelectDataGoods v-model="scope.row.product" :appWindow="appWindow" :count="100" :disabled="mixinEdit_editType == 'update'" 
                                        :apiConfig="$vFN.Tools.getAppGlobalData('componentsApiConfig.SelectDataGoods',appWindow)">
                                    </SelectDataGoods>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-form-item>




                    <el-form-item label="是否需要审核" prop="leader.need_audit" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.leader.need_audit">
                            <el-radio :label="1">需要</el-radio>
                            <el-radio :label="0">不需要</el-radio>
                        </el-radio-group>       
                        <div class="text">需要审核，则用户达到门槛提交申请后，后台审核是否通过；
                            不需要审核，则用户提交申请后，自动成为队长。</div>
                    </el-form-item>

                    <el-form-item label="申请顶部图片" prop="leader.apply_set.top_image" v-if="form.leader.accord_apply == 1">
                        <SelectImageRadio v-model="form.leader.apply_set.top_image" :appWindow="appWindow"
                                :apiConfig="$vFN.Tools.getAppGlobalData('selectResourcesImageApiConfig.resourcesImageBox', appWindow)">
                            </SelectImageRadio>
                    </el-form-item>
                    <el-form-item label="申请按钮文案" prop="leader.apply_set.apply_button_text" v-if="form.leader.accord_apply == 1">
                        <el-input style="width: 50%;" v-model="form.leader.apply_set.apply_button_text" maxlength="10" show-word-limit></el-input>
                    </el-form-item>

                    <el-form-item label="表单">
                        <el-select v-model="form.leader.decoration_id" placeholder="请选择">
                            <el-option :value="0" label="请选择"></el-option>
                            <el-option v-for="item in formList" :key="item.id" :label="item.templateName" :value="item.id">
                            </el-option>
                          </el-select>
                    </el-form-item>
                </LayoutCellItem>


                <!-- <LayoutCellItem title="入口设置">
                    <el-form-item label="分销中心团队分红入口" prop="apply_set.entrance_status" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.apply_set.entrance_status">
                            <el-radio :label="1">显示</el-radio>
                            <el-radio :label="0">不显示</el-radio>
                        </el-radio-group>
                    </el-form-item>

                    <el-form-item label="" v-if="form.apply_set.entrance_status == 1" prop="apply_set.entrance" :rules="{ required: true, message: '不能为空'}">
                        <el-input style="width: 400px;" v-model="form.apply_set.entrance" maxlength="10" show-word-limit></el-input>
                    </el-form-item>
                    
                    <el-form-item label="规则说明" prop="apply_set.rule_note" :rules="{ required: true, message: '规则说明 不能为空'}">
                        <el-input style="width: 50%;" type="textarea" :rows="2" v-model="form.apply_set.rule_note" maxlength="50" show-word-limit></el-input>
                    </el-form-item>

                    <el-form-item label="等级说明" prop="apply_set.level_note" :rules="{ required: true, message: '等级说明 不能为空'}">
                        <el-input style="width: 50%;"  type="textarea" :rows="2" v-model="form.apply_set.level_note" maxlength="50" show-word-limit></el-input>
                    </el-form-item>

                    <el-form-item label="分红订单" prop="apply_set.bonus_order_status" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.apply_set.bonus_order_status">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>                   
                    </el-form-item>

                    <el-form-item label="育人奖订单" prop="apply_set.educate_order_status" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.apply_set.educate_order_status">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>                   
                    </el-form-item>
                    <el-form-item label="团队列表" prop="apply_set.team_status" :rules="{ required: true, message: '请选择'}">
                        <el-radio-group v-model="form.apply_set.team_status">
                            <el-radio :label="1">开启</el-radio>
                            <el-radio :label="0">关闭</el-radio>
                        </el-radio-group>                   
                    </el-form-item>
                </LayoutCellItem> -->

            </LayoutCell>
        </el-form>
    </template>
    <template slot="footer">
        <el-button type="primary" @click="sum()">确定</el-button>
    </template>

</LayoutEditFormBox>